#ifndef _BUS_H
#define _BUS_H

#include "core/dev_cfg.h"
#include <stdint.h>

#ifdef __cplusplus
extern "C"{
#endif

typedef struct bus {
    const char *name;
    int (*match)(void *dev, void *drv);
    void *driver;
    void *device;
}bus_t;

EXTERN DEVICE_PUBLIC(int) bus_register(bus_t *bus);
EXTERN DEVICE_PUBLIC(int) bus_unregister(bus_t *bus);
EXTERN DEVICE_PUBLIC(int) bus_add_driver(bus_t *bus, void *driver);
EXTERN DEVICE_PUBLIC(int) bus_remove_driver(bus_t *bus, void *driver);
EXTERN DEVICE_PUBLIC(int) bus_add_device(bus_t *bus, void *device);
EXTERN DEVICE_PUBLIC(int) bus_remove_device(bus_t *bus, void *device);

#ifdef __cplusplus
}
#endif

#endif
